//
//  BRBaseCell.m
//  Kexu
//
//  Created by IOS on 2023/7/17.
//

#import "BRBaseCell.h"

@implementation BRBaseCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setUI];
    }
    return self;
}

#pragma mark - UI --
- (void)setUI {
    self.backgroundColor = UIColorClear;
    self.contentView.backgroundColor = UIColorClear;
    [self.contentView addSubview:self.contView];
    [self.contView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(14);
        make.right.offset(-14);
        make.top.bottom.offset(0);
    }];
}

- (UIView *)contView {
    if (_contView == nil) {
        
        _contView = [[UIView alloc] init];
        _contView.backgroundColor = UIColor.whiteColor;
        _contView.layer.cornerRadius = 10;
        _contView.layer.masksToBounds = YES;
    }
    return _contView;
}

@end

@implementation BRBase3SubCell


#pragma mark - UI --
- (void)setUI {
    [super setUI];
    
    UIStackView *stack = [[UIStackView alloc] init];
    stack.axis = UILayoutConstraintAxisVertical;
    [self.contView addSubview:stack];
    [stack mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
    }];
    [stack addArrangedSubview:self.topView];
    [stack addArrangedSubview:self.centView];
    [stack addArrangedSubview:self.bottomView];

}

- (UIView *)topView {
    if (_topView == nil) {
        
        _topView = [[UIView alloc] init];
        _topView.backgroundColor = UIColor.whiteColor;
    }
    return _topView;
}
- (UIView *)centView {
    if (_centView == nil) {
        
        _centView = [[UIView alloc] init];
        _centView.backgroundColor = UIColor.whiteColor;
        UIView *line = [BRToolsView getLineView:UIColorMakeWithHex(@"#D2D8E2")];
        [_centView addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.offset(0);
            make.height.mas_equalTo(0.5);
        }];
    }
    return _centView;
}
- (UIView *)bottomView {
    if (_bottomView == nil) {
        
        _bottomView = [[UIView alloc] init];
        _bottomView.backgroundColor = UIColor.whiteColor;
        UIView *line = [BRToolsView getLineView:UIColorMakeWithHex(@"#D2D8E2")];
        [_bottomView addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.offset(0);
            make.height.mas_equalTo(0.5);
        }];
    }
    return _bottomView;
}

@end
